import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2'
// import VitePluginStyleInject from 'vite-plugin-style-inject';

export default defineConfig({
  plugins: [vue()],
  build: {
    lib: {
      entry: './src/index.js',
      name: 'lib'
    },
    rollupOptions: {
   
      context: 'globalThis',
      preserveEntrySignatures: 'strict',
      external: ['vue'],
      output: [
          {
              format: 'umd',
              exports: 'named',
          sourcemap: false,
          name:"index",
              entryFileNames: 'index.min.umd.js',
           
              globals: { vue: 'Vue','$lang':'$lang' }
          },
          {
              format: 'es',
              exports: 'named',
              sourcemap: false,
              entryFileNames: 'index.min.esm.js',
          
              globals: { vue: 'Vue','$lang':'$lang' }
          }
      ]
  }
    
  },
  css: {
    postcss: {
   },
  },
  resolve: {
    alias: {
      '@':'/src/'
    },
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  }
})
